package com.dongqi.business.service.impl;

import com.dongqi.business.service.KtrService;
import com.dongqi.dao.KettleKtrDao;
import com.dongqi.dto.KettleKtrDTO;
import com.dongqi.entity.KettleKtr;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@Slf4j
public class KtrServiceImpl implements KtrService {
    @Autowired
    private KettleKtrDao kettleKtrDao;

    @Override
    public List<KettleKtrDTO> queryKtrList() {
        List<KettleKtr> list = kettleKtrDao.queryKtrList();
        ArrayList<KettleKtrDTO> arrayList = new ArrayList<>();
        if (list!=null && list.size()>0){
            for (KettleKtr kettleKtr : list) {
                KettleKtrDTO dto = new KettleKtrDTO();
                BeanUtils.copyProperties(kettleKtr, dto);
                arrayList.add(dto);
            }
        }
        return arrayList;
    }
}
